const express = require('express');
const router = express.Router();
const InstructionController = require('./instructionController');
const authMiddleware = require('../../middleware/auth');

// 应用认证中间件到所有路由
router.use(authMiddleware.authenticateToken);

// 指令相关路由
router.get('/', InstructionController.getAllInstructions);              // 获取所有指令
router.get('/current', InstructionController.getCurrentInstructions);  // 获取当前指令
router.get('/history', InstructionController.getHistoryInstructions);   // 获取历史指令
router.get('/:id', InstructionController.getInstructionById);          // 根据ID获取指令
router.post('/', InstructionController.createInstruction);             // 创建新指令
router.put('/:id/status', InstructionController.updateInstructionStatus); // 更新指令状态
router.put('/:id/force-post', InstructionController.forcePostInstruction); // 强制过账指令
router.put('/:id/cancel', InstructionController.cancelInstruction);    // 撤销指令
router.delete('/:id', InstructionController.deleteInstruction);        // 删除指令

module.exports = router;